home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
dbase
/
qfile.lha
/
QuickFile3
/
ARexx
/
Demo.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-04-23
|
4KB
|
166 lines
/*
Demo ARexx script for QuickFile
Author: Alan Wigginton
Date: 21 March 1995
*/
options results /* required to make result string available */
if ~open("con","CON:20/10/400/100/ARexx/CLOSE","W") then
exit 20
call writeln("con", "QuickFile ARexx script demo")
call writeln("con", "This requires that QuickFile be running with")
call writeln("con", "the demo AddressBook file open. If necessary")
call writeln("con", "open the file NOW")
call writeln("con", "Enter y to continue, anything else to end")
if upper(readln("con")) ~= "Y" then
exit
if ~show(ports,"QUICKFILE.01") then
call ErrorProc "QuickFile.01 port not found"
address "QUICKFILE.01"
"setfile AddressBook"
"wintofront" /* make sure user can see the window */
/*
Display a simple message in a requester
--------------------------------------
*/
"reqmsg 'OK - Lets load a list style view'"
/*
Load a new view and redraw display according to the view
--------------------------------------------------------
*/
"setview" /* Obtain the current view name */
if result ~= "AddrList.view" then /* Is it already current */
do
"setview AddrList.view"
if rc = 5 then /* Not found - try loading it */
do
"loadview AddrList.view"
if rc > 0 then
call ErrorProc "Error loading AddrList.view"
"setview AddrList.view"
end
end
"reqmsg 'Few database programs have a good list display'"
/*
Here is a simple search of the database. The matching records
are placed in an index named 'Selected'
The 'refresh' command causes an immediate redraw of the display.
Without it, the display is not updated until the macro finishes
*/
"reqmsg 'Now lets find all the Smiths using sounds like'"
"newsearch Lastname sounds smith" /* set search criteria */
"dosearch" /* find all the records */
numfound = result /* returns number found */
"setindex selected" /* Use the selected index */
"refresh"
/* sends reqmsg 'We found x Smiths' to QuickFile */
/* quotes can be tricky */
"reqmsg 'We found" numfound "names that sound like Smith'"
"reqmsg 'Now a sort over country and name'"
"setindex name" /* swap back to a full list */
"sort country a lastname a firstname a"
"refresh" /* and show the result */
"reqmsg 'Here is the sorted list'"
/*
Now lets do some printing
-------------------------
next -9999 goes to top of file
*/
"reqmsg 'This counts records by country - full report'"
"next -9999"
"report -1 screen 'This title inserted from ARexx'"
/*
Select Summary only view and print report
*/
"next -9999"
"reqmsg 'Now a Count by country using Summary Only option'"
"setview SummOnly.view"
if rc = 5 then
do
"loadview SummOnly.view"
if rc > 0 then
call ErrorProc "Error loading SummOnly.view"
"setview SummOnly.view"
end
"report -1 screen"
/*
Field wrap example
*/
"next -9999"
"reqmsg 'and now for field wrapping'"
"setview FieldWrap.view"
if rc = 5 then
do
"loadview FieldWrap.view"
if rc > 0 then
call ErrorProc "Error loading FieldWrap.view"
"setview FieldWrap.view"
end
"report -1 screen"
/*
Label print example
*/
"setindex name"
"reqmsg 'Now some address labels'"
"setview AddrLabels.view"
if rc = 5 then
do
"loadview AddrLabels.view"
if rc > 0 then
call ErrorProc "Error loading AddrLabels.view"
"setview AddrLabels.view"
end
"next -9999"
"report -1 screen"
"reqchoice 'This is a choice requester' 'Press a button'"
if rc = 5 then
"reqmsg 'You chose Cancel (or pressed ESC)'"
else
"reqmsg 'You chose OK (or pressed RETURN)'"
"reqmsg 'Thats all. I hope you like it'"
exit
ErrorProc:
arg msg
call writeln("con", msg)
call writeln("con", "Press return to continue")
call readln("con")
exit